package com.heima.day526_数组;

import java.util.Scanner;

public class select01 {
    public static void main(String[] args) {
        //静态数组arr
        int[] arr = {19, 28, 37, 46, 50};
        int sy = -1;
        //键盘录入
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数： ");
        int num = sc.nextInt();

        //遍历每个数进行判断输入的数是否在数组中存在
        for (int i = 0; i < arr.length; i++) {
            if (num == arr[i]) {
                sy = i;
                break;
            }
        }
        //输出索引
        System.out.println("索引为：" + sy);


    }
}
